//
//  RootViewController.m
//  LHTourApp
//
//  Created by 千锋 on 15/12/23.
//  Copyright (c) 2015年 QianFeng. All rights reserved.
//

#import "RootViewController.h"
#import "HomeScreenViewController.h"
#import "ScenicTableViewController.h"
#import "MapViewController.h"
#import "MeTableViewController.h"
@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createViewControllers];
    [self customTabBarItem];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)createViewControllers
{
    HomeScreenViewController * homeVC = [[HomeScreenViewController alloc]init];
    homeVC.title = @"主页";
    UINavigationController * homeNavi = [[UINavigationController alloc]initWithRootViewController:homeVC];
    ScenicTableViewController * scenicVC = [[ScenicTableViewController alloc]init];
    scenicVC.title = @"景点";
    UINavigationController * scenicNavi = [[UINavigationController alloc]initWithRootViewController:scenicVC];
    MapViewController * mapVC =[[MapViewController alloc]init];
    UINavigationController * mapNavi = [[UINavigationController alloc]initWithRootViewController:mapVC];
    mapVC.title = @"推荐";
    NSArray * viewControllers = @[homeNavi,scenicNavi,mapNavi];
    self.viewControllers = viewControllers;

}

-(void)customTabBarItem
{
    NSArray * viewControllers = self.viewControllers;
    UIImage * homeImage = [[UIImage imageNamed:@"tab_0"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UIImage * homeSelectedImage = [[UIImage imageNamed:@"tab_c0"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UITabBarItem * homeItem = [[UITabBarItem alloc]initWithTitle:@"主页" image:homeImage selectedImage:homeSelectedImage];
    UIViewController * homeNavi = viewControllers[0];
    homeNavi.tabBarItem = homeItem;
    
    UIImage * scenicImage = [[UIImage imageNamed:@"tab_1"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UIImage * scenicSelectdeImage = [[UIImage imageNamed:@"tab_c1"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UITabBarItem * scenicItem = [[UITabBarItem alloc]initWithTitle:@"景点" image:scenicImage selectedImage:scenicSelectdeImage];
    UIViewController * scenicNavi = viewControllers[1];
    scenicNavi.tabBarItem = scenicItem;
    
    UIImage * mapImage = [[UIImage imageNamed:@"tab_2"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UIImage * mapSelectdeImage = [[UIImage imageNamed:@"tab_c2"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UITabBarItem * mapItem = [[UITabBarItem alloc]initWithTitle:@"推荐" image:mapImage selectedImage:mapSelectdeImage];
    UIViewController * mapNavi = viewControllers[2];
    mapNavi.tabBarItem = mapItem;
    
    

}


@end
